#ifndef __CRYPT__
#define __CRYPT__

#define AES_BLOCK_SIZE 256

/* Generates a KEY_LEN long key, and puts it in KEY */
void gen_key (int key_len, unsigned char *key);

/* 
  Encrypts plaintext of length plaintext_len (including the NULL
  character at the end), and puts the encrypted data in ciphertext
  (which, although, most probably would be not text :D)

  Also puts the length of the encrypted text in outlen.

  ciphertext approximately should have space for 
  plaintext_len + (AES_BLOCK_SIZE/8) 
*/
void aes_encrypt (unsigned char *key, unsigned char *iv, 
                    unsigned char *plaintext, int plaintext_len, 
                    unsigned char *ciphertext, int *outlen);

/* 
  Decrypts ciphertext of length ciphertext_len and puts the decrypted 
  data in plaintext 

  Also puts the length of the decrypted text in outlen.

  plaintext should have space for ciphertext_len [Actually somewhat less
  than that. But too lazy to calculate that]
*/

void aes_decrypt (unsigned char *key, unsigned char *iv, 
                    unsigned char *ciphertext, int ciphertext_len, 
                    unsigned char *plaintext, int *outlen);
 
#endif /* CRYPT */
